#include "Strategy.hh"








void
Strategy::set_potentials(void)
{
  TRACK();
  Map<Square> & map(state.map);
  
  bug << "reset potential" << std::endl;
  for(Map<float>::iterator cell_it = potential.begin();
      cell_it !=  potential.end(); ++cell_it)
    {
      *cell_it = 0.0;
    }



  
  if(not state.food.empty())
    {
      bug << "Basic starvation instinct" <<  std::endl;
      for(std::vector<uLocation>::const_iterator food_it = state.food.begin();
	  food_it!= state.food.end(); ++food_it)
	{
	  bug << "food at " << torus.to_str(*food_it) 
	      << (map[*food_it].isVisible ? " visible" : " invisible") 
	      << std::endl;
	  attraction(potential,*food_it,torus.size/2,torus.spawnRadius,10,foodw, isGloballyWalkable);
	}
    }


  if(not state.enemyHills.empty())
    {
      for(std::vector<Ant>::const_iterator hill_it = state.enemyHills.begin();
	  hill_it!= state.enemyHills.end(); ++hill_it)
	{
	  bug << "enemy Hill at " << torus.to_str(hill_it->loc) 
	      << (map[hill_it->loc].isVisible ? "visible" : "invisible") 
	      << std::endl;
	  attraction(potential,hill_it->loc,torus.size/2,0,10,hillw,isGloballyWalkable);
	}
    }

  
  for(std::vector<uLocation>::const_iterator hill_it = state.myHills.begin();
      hill_it!= state.myHills.end(); ++hill_it)
    {
      bug << "my Hill at " << torus.to_str(*hill_it);
      if(isInvisible(map.at(*hill_it)))
	{
	  bug << " invisible!";
	  attraction(potential,*hill_it,torus.size/2,0,1,explow,isGloballyWalkable);
	}
      else
	{
	  bug << " visible";
	}
      bug << std::endl;
    }






}






